package lee.com.mqttlibrary.model;

import android.os.Parcel;
import android.os.Parcelable;


/**
 * CreateDate：18-10-31 on 上午10:36
 * Describe:
 * Coder: lee
 */
public class MQTTCallMessage implements Parcelable {
    private int type;
    private long userId;
    private long targetId;
    private long callId;

    private MQTTType mqttType;

    private int number;
    private int online;
    private int isCall;

    private int received;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public long getTargetId() {
        return targetId;
    }

    public void setTargetId(long targetId) {
        this.targetId = targetId;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public int getOnline() {
        return online;
    }

    public void setOnline(int online) {
        this.online = online;
    }

    public int getIsCall() {
        return isCall;
    }

    public void setIsCall(int isCall) {
        this.isCall = isCall;
    }

    public long getCallId() {
        return callId;
    }

    public void setCallId(long callId) {
        this.callId = callId;
    }

    public MQTTType getMqttType() {
        return mqttType;
    }

    public void setMqttType(MQTTType mqttType) {
        this.mqttType = mqttType;
    }

    public int getReceived() {
        return received;
    }

    public void setReceived(int received) {
        this.received = received;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.type);
        dest.writeLong(this.userId);
        dest.writeLong(this.targetId);
        dest.writeLong(this.callId);
        dest.writeInt(this.mqttType == null ? -1 : this.mqttType.ordinal());
        dest.writeInt(this.number);
        dest.writeInt(this.online);
        dest.writeInt(this.isCall);
        dest.writeInt(this.received);
    }

    public MQTTCallMessage() {
    }

    protected MQTTCallMessage(Parcel in) {
        this.type = in.readInt();
        this.userId = in.readInt();
        this.targetId = in.readLong();
        this.callId = in.readInt();
        int tmpMqttType = in.readInt();
        this.mqttType = tmpMqttType == -1 ? null : MQTTType.values()[tmpMqttType];
        this.number = in.readInt();
        this.online = in.readInt();
        this.isCall = in.readInt();
        this.received = in.readInt();
    }

    public static final Parcelable.Creator<MQTTCallMessage> CREATOR = new Parcelable.Creator<MQTTCallMessage>() {
        @Override
        public MQTTCallMessage createFromParcel(Parcel source) {
            return new MQTTCallMessage(source);
        }

        @Override
        public MQTTCallMessage[] newArray(int size) {
            return new MQTTCallMessage[size];
        }
    };


    @Override
    public String toString() {
        return "MQTTCallMessage{" +
                "mqttType=" + mqttType +
                ", type=" + type +
                ", userId=" + userId +
                ", targetId=" + targetId +
                ", callId=" + callId +
                ", number=" + number +
                ", online=" + online +
                ", isCall=" + isCall +
                ", received=" + received +
                '}';
    }
}
